.class public Lcom/xingbook/c/a;
.super Ljava/lang/Object;

# interfaces
.implements Landroid/media/MediaPlayer$OnErrorListener;


# static fields
.field private static a:Lcom/xingbook/c/a;


# instance fields
.field private b:Landroid/media/MediaPlayer;

.field private c:Landroid/media/SoundPool;

.field private d:Landroid/util/SparseIntArray;

.field private e:F

.field private f:Landroid/content/Context;


# direct methods
.method private constructor <init>()V
    .locals 2

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    const/4 v0, 0x0

    iput v0, p0, Lcom/xingbook/c/a;->e:F

    new-instance v0, Landroid/media/MediaPlayer;

    invoke-direct {v0}, Landroid/media/MediaPlayer;-><init>()V

    iput-object v0, p0, Lcom/xingbook/c/a;->b:Landroid/media/MediaPlayer;

    iget-object v0, p0, Lcom/xingbook/c/a;->b:Landroid/media/MediaPlayer;

    const/4 v1, 0x3

    invoke-virtual {v0, v1}, Landroid/media/MediaPlayer;->setAudioStreamType(I)V

    iget-object v0, p0, Lcom/xingbook/c/a;->b:Landroid/media/MediaPlayer;

    invoke-virtual {v0, p0}, Landroid/media/MediaPlayer;->setOnErrorListener(Landroid/media/MediaPlayer$OnErrorListener;)V

    return-void
.end method

.method public static a()Lcom/xingbook/c/a;
    .locals 1

    sget-object v0, Lcom/xingbook/c/a;->a:Lcom/xingbook/c/a;

    if-nez v0, :cond_0

    new-instance v0, Lcom/xingbook/c/a;

    invoke-direct {v0}, Lcom/xingbook/c/a;-><init>()V

    sput-object v0, Lcom/xingbook/c/a;->a:Lcom/xingbook/c/a;

    :cond_0
    sget-object v0, Lcom/xingbook/c/a;->a:Lcom/xingbook/c/a;

    return-object v0
.end method


# virtual methods
.method public a(I)V
    .locals 7

    :try_start_0
    iget-object v0, p0, Lcom/xingbook/c/a;->c:Landroid/media/SoundPool;

    iget-object v1, p0, Lcom/xingbook/c/a;->d:Landroid/util/SparseIntArray;

    invoke-virtual {v1, p1}, Landroid/util/SparseIntArray;->get(I)I

    move-result v1

    iget v2, p0, Lcom/xingbook/c/a;->e:F

    iget v3, p0, Lcom/xingbook/c/a;->e:F

    const/4 v4, 0x1

    const/4 v5, 0x0

    const/high16 v6, 0x3f80

    invoke-virtual/range {v0 .. v6}, Landroid/media/SoundPool;->play(IFFIIF)I
    :try_end_0
    .catch Ljava/lang/NullPointerException; {:try_start_0 .. :try_end_0} :catch_0

    :goto_0
    return-void

    :catch_0
    move-exception v0

    goto :goto_0
.end method

.method public varargs a(Landroid/content/Context;[I)V
    .locals 7

    const/4 v6, 0x3

    iput-object p1, p0, Lcom/xingbook/c/a;->f:Landroid/content/Context;

    new-instance v0, Landroid/media/SoundPool;

    const/16 v1, 0xa

    const/16 v2, 0x64

    invoke-direct {v0, v1, v6, v2}, Landroid/media/SoundPool;-><init>(III)V

    iput-object v0, p0, Lcom/xingbook/c/a;->c:Landroid/media/SoundPool;

    array-length v1, p2

    new-instance v0, Landroid/util/SparseIntArray;

    invoke-direct {v0}, Landroid/util/SparseIntArray;-><init>()V

    iput-object v0, p0, Lcom/xingbook/c/a;->d:Landroid/util/SparseIntArray;

    const/4 v0, 0x0

    :goto_0
    if-lt v0, v1, :cond_0

    iget-object v0, p0, Lcom/xingbook/c/a;->f:Landroid/content/Context;

    const-string v1, "audio"

    invoke-virtual {v0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/media/AudioManager;

    if-nez v0, :cond_1

    const/high16 v0, 0x3f80

    iput v0, p0, Lcom/xingbook/c/a;->e:F

    :goto_1
    return-void

    :cond_0
    iget-object v2, p0, Lcom/xingbook/c/a;->d:Landroid/util/SparseIntArray;

    iget-object v3, p0, Lcom/xingbook/c/a;->c:Landroid/media/SoundPool;

    aget v4, p2, v0

    const/4 v5, 0x1

    invoke-virtual {v3, p1, v4, v5}, Landroid/media/SoundPool;->load(Landroid/content/Context;II)I

    move-result v3

    invoke-virtual {v2, v0, v3}, Landroid/util/SparseIntArray;->put(II)V

    add-int/lit8 v0, v0, 0x1

    goto :goto_0

    :cond_1
    invoke-virtual {v0, v6}, Landroid/media/AudioManager;->getStreamVolume(I)I

    move-result v1

    int-to-float v1, v1

    invoke-virtual {v0, v6}, Landroid/media/AudioManager;->getStreamMaxVolume(I)I

    move-result v0

    int-to-float v0, v0

    div-float v0, v1, v0

    iput v0, p0, Lcom/xingbook/c/a;->e:F

    goto :goto_1
.end method

.method public a(Ljava/io/FileDescriptor;JJZ)V
    .locals 6

    iget-object v0, p0, Lcom/xingbook/c/a;->b:Landroid/media/MediaPlayer;

    invoke-virtual {v0}, Landroid/media/MediaPlayer;->reset()V

    iget-object v0, p0, Lcom/xingbook/c/a;->b:Landroid/media/MediaPlayer;

    invoke-virtual {v0, p6}, Landroid/media/MediaPlayer;->setLooping(Z)V

    :try_start_0
    iget-object v0, p0, Lcom/xingbook/c/a;->b:Landroid/media/MediaPlayer;

    move-object v1, p1

    move-wide v2, p2

    move-wide v4, p4

    invoke-virtual/range {v0 .. v5}, Landroid/media/MediaPlayer;->setDataSource(Ljava/io/FileDescriptor;JJ)V

    iget-object v0, p0, Lcom/xingbook/c/a;->b:Landroid/media/MediaPlayer;

    invoke-virtual {v0}, Landroid/media/MediaPlayer;->prepare()V

    iget-object v0, p0, Lcom/xingbook/c/a;->b:Landroid/media/MediaPlayer;

    invoke-virtual {v0}, Landroid/media/MediaPlayer;->start()V
    :try_end_0
    .catch Ljava/lang/IllegalArgumentException; {:try_start_0 .. :try_end_0} :catch_2
    .catch Ljava/lang/IllegalStateException; {:try_start_0 .. :try_end_0} :catch_1
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    :goto_0
    return-void

    :catch_0
    move-exception v0

    goto :goto_0

    :catch_1
    move-exception v0

    goto :goto_0

    :catch_2
    move-exception v0

    goto :goto_0
.end method

.method public b()V
    .locals 1

    iget-object v0, p0, Lcom/xingbook/c/a;->b:Landroid/media/MediaPlayer;

    invoke-virtual {v0}, Landroid/media/MediaPlayer;->isPlaying()Z

    move-result v0

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/xingbook/c/a;->b:Landroid/media/MediaPlayer;

    invoke-virtual {v0}, Landroid/media/MediaPlayer;->pause()V

    iget-object v0, p0, Lcom/xingbook/c/a;->b:Landroid/media/MediaPlayer;

    invoke-virtual {v0}, Landroid/media/MediaPlayer;->stop()V

    :cond_0
    return-void
.end method

.method public c()V
    .locals 1

    iget-object v0, p0, Lcom/xingbook/c/a;->b:Landroid/media/MediaPlayer;

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/xingbook/c/a;->b:Landroid/media/MediaPlayer;

    invoke-virtual {v0}, Landroid/media/MediaPlayer;->isPlaying()Z

    move-result v0

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/xingbook/c/a;->b:Landroid/media/MediaPlayer;

    invoke-virtual {v0}, Landroid/media/MediaPlayer;->pause()V

    :cond_0
    return-void
.end method

.method public d()V
    .locals 1

    iget-object v0, p0, Lcom/xingbook/c/a;->b:Landroid/media/MediaPlayer;

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/xingbook/c/a;->b:Landroid/media/MediaPlayer;

    invoke-virtual {v0}, Landroid/media/MediaPlayer;->start()V

    :cond_0
    return-void
.end method

.method public e()V
    .locals 2

    const/4 v1, 0x0

    iget-object v0, p0, Lcom/xingbook/c/a;->b:Landroid/media/MediaPlayer;

    if-eqz v0, :cond_0

    invoke-virtual {p0}, Lcom/xingbook/c/a;->b()V

    iget-object v0, p0, Lcom/xingbook/c/a;->b:Landroid/media/MediaPlayer;

    invoke-virtual {v0}, Landroid/media/MediaPlayer;->release()V

    iput-object v1, p0, Lcom/xingbook/c/a;->b:Landroid/media/MediaPlayer;

    :cond_0
    iget-object v0, p0, Lcom/xingbook/c/a;->c:Landroid/media/SoundPool;

    if-eqz v0, :cond_1

    iget-object v0, p0, Lcom/xingbook/c/a;->c:Landroid/media/SoundPool;

    invoke-virtual {v0}, Landroid/media/SoundPool;->release()V

    iput-object v1, p0, Lcom/xingbook/c/a;->c:Landroid/media/SoundPool;

    :cond_1
    sput-object v1, Lcom/xingbook/c/a;->a:Lcom/xingbook/c/a;

    return-void
.end method

.method public onError(Landroid/media/MediaPlayer;II)Z
    .locals 1

    const/4 v0, 0x0

    return v0
.end method
